<template>
  <div>
      <h1>第一题</h1>
      <p>随机取出一个名字:"小花", "小明", "小可爱", "小王"</p>
      <button @click="btn">点击随机生成</button>
      <span>{{ name }}</span>
  </div>
</template>

<script>
export default {
  data () {
    return {
      arr:["小花", "小明", "小可爱", "小王"],
      name:''
    }
  },
  methods : {
    btn(){
      // console.log(this.arr.length);
      const num = Math.floor(Math.random() * (this.arr.length - 1))
      this.name = this.arr[num]
    }
  }
}
</script>

<style>

</style>